package 设计类和对象;

public class 俩个变量指向同一个对象的内存图 {
    public static void main(String[] args) {
        Student s1= new Student();
        s1.name="小明";
        s1.age=18;
        s1.sex='男';
        Student s2=s1;
        System.out.println(s2);
        System.out.println(s1);//地址相同
        System.out.println(s2.name);
        System.out.println(s1.name);
        System.out.println(s2.age);
        System.out.println(s1.age);
        System.out.println(s2.sex);
        System.out.println(s1.sex);
    }
}
